package org.link.aspect;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

/**
 * 
 * project_name:ssmmaven
 * package_name:org.link.aspect
 * file_name:AnnotationAspect.java
 * @author Link
 * create_date:2015年12月9日 下午4:51:38
 * modified_date:
 * description: 基于注解形式的aspect
 *
 */
@Aspect
public class AnnotationAspect {

	@Resource
	private HttpServletRequest request;
	
	@Before("execution(* org.link.service.*.*(..))")
	public void before(){
		HttpSession session = request.getSession();
		String name = (String) session.getAttribute("name");
		System.out.println("当前注册人员的用户名为:"+name);
	}
	
	@After("execution(* org.link.service.*.*(..))")
	public void after(){
		//HttpSession session = request.getSession();
		//String name = (String) session.getAttribute("name");
		System.out.println("当前注册人员的用户名为:");
	}
	
	
}







